import request from '@/utils/request'

export const getRoleListAPI = (params) => {
  return request.get('/sys/role', {
    params
  })
}

export const addRoleAPI = (data) => {
  return request.post('/sys/role', data)
}

export const editRoleAPI = (data) => {
  return request.put(`/sys/role/${data.id}`, data)
}

export const deleteRoleAPI = (id) => {
  return request.delete(`/sys/role/${id}`)
}

/**
 * 获取角色详情
 * **/

export function getRoleDetailAPI(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

/**
 * 给角色分配权限
 *
 * ***/

export function assignPermAPI(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
